package com.zt.action;

import java.util.List;
import java.util.Map;

import org.apache.struts2.interceptor.RequestAware;
import org.apache.struts2.interceptor.SessionAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ModelDriven;
import com.zt.comm.Const;
import com.zt.page.Page;
import com.zt.pojo.HRMonthlyReport;
import com.zt.service.HRMonthlyReportService;

@Controller("hRMonthlyReportAction")
public class HRMonthlyReportAction implements ModelDriven,RequestAware,SessionAware{
	private static final long serialVersionUID = 1L;
	@Autowired
    private HRMonthlyReportService hRMonthlyReportService;
	private Map<String,Object> requestMap,sessionMap;
	private HRMonthlyReport hRMonthlyReport=new HRMonthlyReport();
	public String findHRReport(){
		String msg=Const.ERROR;
		System.out.println("月报系统进来了");
		Page<HRMonthlyReport> page = hRMonthlyReportService.showHR();
		List<HRMonthlyReport> list = page.getList();
		if(list!=null && list.size()>0){
			for(HRMonthlyReport hr:list) {
				System.out.println("hr="+hr);				
			}
			msg=Const.SUCCESS;
			requestMap.put("hrs", list);				
		}else{
			sessionMap.put("errMsg", "Dao层取值为空值");
		}
		return msg;
	}
	@Override
	public void setRequest(Map<String, Object> arg0) {
		this.requestMap=arg0;
	}
	@Override
	public void setSession(Map<String, Object> arg0) {
		this.sessionMap=arg0;
	}
	@Override
	public Object getModel() {
		return hRMonthlyReport;
	}
}
